<?php
use Inationsoft\NS;
use Inationsoft\NS\Core\Model;
use Inationsoft\NS\Net\Http\Cookie;
use Inationsoft\NS\String;
use Inationsoft\NS\UI\ScriptManager;
use Inationsoft\NS\UI\StyleManager;
use Inationsoft\Koma;
use Inationsoft\Koma\BlockController;
use Inationsoft\Koma\User;

define('DEFAULT_PAGE_LIMIT', 15);

class MenuBlock extends BlockController {
	function run() {
		$uh = User::getInstance();
		$model = Model::getInstance('MenuModel');

		$menus = array();

		foreach($model->getAllEnabled(null, array('enabled' => '1'), array('sort_order' => Model::ORDER_ASC)) as $key => $item) {
			if($item['permission'] == 0 || $uh->hasRID($item['permission'])) {
				$menus[$key] = $item; 
			}
		}
		
		$this->View->File = 'block/menublock.php';
		$this->View->assign('menus', $menus);
		//$this->View->assign('menus', $model->getAllEnabled());

		return true;
	}
}
?>